<script setup lang="ts">
import { reactive, ref } from 'vue'
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
import { useUserStore } from '@/stores/user.ts'

const ruleFormRef = ref<FormInstance>()
const store = useUserStore()

const ruleForm = reactive({
  userAccount: '',
  userPassword: '',
  checkPassword: '',
})


</script>

<template>
  <el-form
    ref="ruleFormRef"
    style="max-width: 600px"
    :model="ruleForm"
    status-icon
    label-width="auto"
    label-position="left"
    class="demo-ruleForm"
  >
    <el-form-item label="用户名" prop="username" >
      <el-input v-model="ruleForm.userAccount" autocomplete="off" />
    </el-form-item>
    <el-form-item label="密码" prop="pass" >
      <el-input v-model="ruleForm.userPassword" type="password" autocomplete="off" />
    </el-form-item>
    <el-form-item label="确认密码" prop="pass" >
      <el-input v-model="ruleForm.checkPassword"  type="password" autocomplete="off" />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" style="width: 100%" @click="store.register(ruleForm)"> 注册 </el-button>
    </el-form-item>
  </el-form>
</template>

<style scoped lang="scss"></style>
